Lisp: Good News, Bad News, How to Win Big

نویسنده

  • Richard P. Gabriel
چکیده

Lisp has done quite well over the last ten years: becoming nearly standardized, forming the basis of a commercial sector, achieving excellent performance, having good environments, able to deliver applications. Yet the Lisp community has failed to do as well as it could have. In this paper I look at the successes, the failures, and what to do next. The Lisp world is in great shape: Ten years ago there was no standard Lisp; the most standard Lisp was InterLisp, which ran on PDP-10’s and Xerox Lisp machines (some said it ran on Vaxes, but I think they exaggerated); the second most standard Lisp was MacLisp, which ran only on PDP-10’s, but under the three most popular operating systems for that machine; the third most standard Lisp was Portable Standard Lisp, which ran on many machines, but very few people wanted to use it; the fourth most standard Lisp was Zetalisp, which ran on two varieties of Lisp machine; and the fifth most standard Lisp was Scheme, which ran on a few different kinds of machine, but very few people wanted to use it. By today’s standards, each of these had poor or just barely acceptable performance, nonexistent or just barely satisfactory environments, nonexistent or poor integration with other languages and software, poor portability, poor acceptance, and poor commercial prospects. Today there is Common Lisp (CL), which runs on all major machines, all major operating systems, and virtually in every country. Common Lisp is about to be standardized by ANSI, has good performance, is surrounded with good environments, and has good integration with other languages and software. But, as a business, Lisp is considered to be in ill health. There are persistent and sometimes true rumors about the abandonment of Lisp as a vehicle for delivery of practical applications. To some extent the problem is one of perception—there are simply better Lisp delivery solutions than are generally believed to exist and to a disturbing extent the problem is one of unplaced or misplaced resources, of projects not undertaken, and of implementation strategies not activated. Part of the problem stems from our very dear friends in the artificial intelligence (AI) business. AI has a number of good approaches to formalizing human knowledge and problem solving behavior. However, AI does not provide a panacea in any area of its applicability. Some early promoters of AI to the commercial world raised expectation levels too high. These expectations had to do with the effectiveness and deliverability of expert-system-based applications. When these expectations were not met, some looked for scapegoats, which frequently were the Lisp companies, particularly when it came to deliverability. Of course, if the AI companies had any notion about what the market would eventually expect from delivered AI software, they never shared it with any Lisp companies I know about. I believe the attitude of the AI companies was that the Lisp companies will do what they need to survive, so why share customer lists and information with them? Lisp: Good News, Bad News, How to Win Big December 2, 2000 1 Another part of the problem is the relatively bad press Lisp got, sometimes from very respectable publications. I saw an article in Forbes (October 16, 1989) entitled Where Lisp Slipped, by Julie Pitta. However, the article was about Symbolics and its fortunes. The largest criticisms of Symbolics in the article are that Symbolics believed AI would take off and that Symbolics mistakenly pushed its view that proprietary hardware was the way to go for AI. There was nothing about Lisp in the article except the statement that it is a somewhat obscure programming language used extensively in artificial intelligence. It seems a pity for the Lisp business to take a bump partly because Julie thought she could make a cute title for her article out of the name “Lisp.” But, there are some real successes for Lisp, some problems, and some ways out of those problems. 1.0 Lisp’s Successes As I mentioned, Lisp is in better shape today than it ever has been. I want to review some Lisp success stories. 1.1 Standardization A major success is that there is a standard Lisp—Common Lisp. Many observers today wish there were a simpler, smaller, cleaner Lisp that could be standardized, but the Lisp that we have today that is ready for standardization is Common Lisp. This isn’t to say that a better Lisp could not be standardized later, and certainly there should be. Furthermore, like any language, Common Lisp should be improved and changed as needs change. Common Lisp started as a grassroots effort in 1981 after an ARPA-sponsored meeting held at SRI to determine the future of Lisp. At that time there were a number of Lisps in the US being defined and implemented by former MIT folks: Greenblatt (LMI), Moon and Weinreb (Symbolics), Fahlman and Steele (CMU), White (MIT), and Gabriel and Steele (LLNL). The core of the Common Lisp committee came from this group. That core was Fahlman, Gabriel, Moon, Steele, and Weinreb, and Common Lisp was a coalescence of the Lisps these people cared about. There were other Lisps that could have blended into Common Lisp, but they were not so clearly in the MacLisp tradition, and their proponents declined to actively participate in the effort because they predicted success for their own dialects over any common lisp that was defined by the grassroots effort. Among these Lisps were Scheme, Interlisp, Franz Lisp, Portable Standard Lisp, and Lisp370. And outside the US there were major Lisp efforts, including Cambridge Lisp and Le-Lisp. The humble US grassroots effort did not seek membership from outside the US, and one can safely regard that as a mistake. Frankly, it never occurred to the Common Lisp group that this purely American effort would be of interest outside the US, because very few of the group saw a future in AI that would extend the needs for a standard Lisp beyond North America. Common Lisp was defined and a book published in 1984 called Common Lisp: the Language (CLtL). And several companies sprang up to put Common Lisp on stock hardware to compete against the Lisp machine companies. Within four years, virtually every major computer company Lisp: Good News, Bad News, How to Win Big December 2, 2000 2 had a Common Lisp that it had either implemented itself or private-labeled from a Common Lisp company. In 1986, X3J13 was formed to produce an ANSI version of Common Lisp. By then it was apparent that there were significant changes required to Common Lisp to clean up ambiguities and omissions, to add a condition system, and to define object-oriented extensions. After several years it became clear that the process of standardization was not simple, even given a mature language with a good definition. The specification of the Common Lisp Object System (CLOS) alone took nearly two years and seven of the most talented members of X3J13. It also became apparent that the interest in international Lisp standardization was growing. But there was no heir apparent to Common Lisp. Critics of Common Lisp, especially those outside the US, focused on Common Lisp’s failures as a practical delivery vehicle. In 1988, an international working group for the standardization of Lisp was formed. That group is called WG16. Two things are absolutely clear: The near-term standard Lisp is Common Lisp; a longer-term standard that goes beyond Common Lisp is desirable. In 1988, the IEEE Scheme working group was formed to produce an IEEE and possibly an ANSI standard for Scheme. This group completed its work in 1990, and the relatively small and clean Scheme is a standard. Currently, X3J13 is less than a year away from a draft standard for ANSI Common Lisp; WG16 is stalled because of international bickering; Scheme has been standardized by IEEE, but it is of limited commercial interest. Common Lisp is in use internationally, and serves at least as a de facto standard until the always contentious Lisp community agrees to work together. 1.2 Good Performance Common Lisp performs well. Most current implementations use modern compiler technology, in contrast to older Lisps, which used very primitive compiler techniques, even for the time. In terms of performance, anyone using a Common Lisp today on almost any computer can expect better performance than could be obtained on single-user PDP-10’s or on single-user Lisp machines of mid1980’s vintage. Many Common Lisp implementations have multitasking and non-intrusive garbage collection—both regarded as impossible features on stock hardware ten years ago. In fact, Common Lisp performs well on benchmarks compared to C. The following table shows the ratio of Lisp time and code size to C time and code size for three benchmarks: Benchmark CPU Time Code Size Tak 0.90 1.21 Traverse 0.98 1.35 Lexer 1.07 1.48 Lisp: Good News, Bad News, How to Win Big December 2, 2000 3 Tak is a Gabriel benchmark that measures function calling and fixnum arithmetic. Traverse is a Gabriel benchmark that measures structure creation and access. Lexer is the tokenizer of a C compiler and measures dispatching and character manipulation. These benchmarks were run on a Sun 3 in 1987 using the standard Sun C compiler using full optimization. The Lisp was not running a non-intrusive garbage collector. 1.3 Good Environments It is arguable that modern programming environments come from the Lisp and AI tradition. The first bit-mapped terminals (Stanford/MIT), the mouse pointing device (SRI), full-screen text editors (Stanford/MIT), and windowed environments (Xerox PARC) all came from laboratories engaged in AI research. Even today one can argue that the Symbolics programming environment represents the state of the art. It is also arguable that the following development environment features originated in the Lisp world: • incremental compilation and loading • symbolic debuggers • data inspectors • source code level single stepping • help on builtin operators • window-based debugging • symbolic stack backtraces • structure editors Today’s Lisp environments are equal to the very best Lisp machine environments in the 1970’s. Windowing, fancy editing, and good debugging are all commonplace. In some Lisp systems, significant attention has been paid to the software lifecycle through the use of source control facilities, automatic cross-referencing, and automatic testing. 1.4 Good Integration Today Lisp code can coexist with C, Pascal, Fortran, etc. These languages can be invoked from Lisp and in general, these languages can then re-invoke Lisp. Such interfaces allow the programmer to pass Lisp data to foreign code, to pass foreign data to Lisp code, to manipulate foreign data from Lisp code, to manipulate Lisp data from foreign code, to dynamically load foreign programs, and to freely mix foreign and Lisp functions. The facilities for this functionality are quite extensive and provide a means for mixing several different languages at once. 1.5 Object-oriented Programming Lisp has the most powerful, comprehensive, and pervasively object-oriented extensions of any language. CLOS embodies features not found in any other object-oriented language. These include the following: Lisp: Good News, Bad News, How to Win Big December 2, 2000 4 • multiple inheritance • generic functions including multi-methods • first-class classes • first-class generic functions • metaclasses • method combination • initialization protocols • metaobject protocol • integration with Lisp types It is likely that Common Lisp (with CLOS) will be the first standardized object-oriented programming language. 1.6 Delivery It is possible to deliver applications written in Lisp. As we shall see, the currently available tools are good but are not yet ideal. The remainder of this section is about a successful approach to delivery taken by Lucid. The Lucid Delivery Tool Kit comprises three tool sets: Performance Monitoring, Reorganization, and Treeshaking. 1.6.1 Performance Monitoring Tools The Performance Monitoring tools provide information about dynamic behavior of programs. Because storage allocation and deallocation is often an important factor in program performance, the tools also provide information about storage allocation. While there is nothing novel about these tools, their use is almost always critical to achieving good program performance. 1.6.2 The Reorganizer For programs whose working set exceeds available real memory, the time spent inside virtual memory system-code can greatly exceed the time spent in user-code. For example, let us assume that we have a program which does nothing but memory-reference instructions randomly throughout its working set. If we denote by WS the working set of a program, by Mem the real memory available to that program, and by Utime the time spent in actual user-code, and by Total the total run time for the program, a simple analysis gives the following equations for Total: , for , for Pft is the page-fault-time—that is, amount of time it takes to handle a page-fault. On typical machines this number is usually 1,000 to 10,000 times as long as it takes to execute a memory-reference instruction that doesn’t cause a page-fault.1 Because a Lisp program can often have a working set exceeding available memory, tools that help reduce working set can lead to very large performance improvements. In some cases, the working set Total Utime = WS Mem ≤ Total Utime Pft WS Mem – ( ) WS ( ) ⁄ ⋅ + = WS Mem > Lisp: Good News, Bad News, How to Win Big December 2, 2000 5 can be reduced by lessening reliance on dynamically allocated objects—that is, by lessening CONSing of the program. However, in instances where the working set size is due primarily to references to permanent objects, other techniques are needed. The approach taken in the Lucid Delivery Tool Kitis to reorganize the permanent objects in the Lisp address space so as to place objects that have similar patterns of reference at nearby addresses. (In particular, this means at least segregating the objects that are referenced by a program from those that are not.) 1.6.3 The Treeshaker Most Lisp development systems, including Lucid’s, provide all the resources of the Lisp system by default, and this in turn leads to a style of development in which the programmer makes use of whatever tool happens to be most convenient.2 Because much of the basic Lisp system (or any development system built on top of the basic Lisp system) will generally be unused by a given application, it is very worthwhile to have a tool for excising these unused parts. This tool is called the Treeshaker.3 Treeshaker execution occurs in three phases: walking, testing and writing. In the walking phase, the Treeshaker accumulates a set of objects that need to be included in the saved image. After making this set, the treeshaker runs a test of the application to check that all objects which are used in a typical run have been included. The writing phase then generates an executable image which will run the application. To a first approximation, the walk phase is just a matter of computing the connected component of the Lisp image (treated as a directed graph in the obvious way) generated by the application’s toplevel function. However, because of the way that Lisp objects are generally connected this usually includes almost the entire Lisp image including the unused subsystems. Therefore the treeshaker uses several techniques to find connections between objects that do not actually need to be followed in the walk. 1.6.4 Results The first example is a simple expert system that helps align magnetic resonance imaging equipment. The results are for the original program, and a reorganized and treeshaken version running two dif1. Adapting the equation to a more normal mix of instructions involves only changing the value of Pft, and it is not unusual for the adjusted Pft to lie in the range of 100 to 1000. 2. This is in contrast to a language such as C where the default is a sort of “machine-independent”’ assembly language, and including other tools requires an explicit use of the appropriate library. Of course, this may lead to a more deliberate style of programming, but it is at the cost of making the programmer’s job more tedious. 3. The name Treeshaker is meant to be evocative of the idea of actually shaking a tree to dislodge dead branches or other trash. Lisp: Good News, Bad News, How to Win Big December 2, 2000 6 ferent tests, a short and a long test. WS is the working set in megabytes. The time is expressed as hours:minutes. The second example is Reduce, a symbolic algebra system. The three programs are the original, a treeshaken version, and a treeshaken and reorganized version. The CPU column is the time in seconds the CPU spent executing user code—that is, all other time is page fault handling time. 2.0 Lisp’s Apparent Failures Too many teardrops for one heart to be crying. Too many teardrops for one heart to carry on. You’re way on top now, since you left me, Always laughing, way down at me. ? & The Mysterians This happy story, though, has a sad interlude, an interlude that might be attributed to the failure of AI to soar, but which probably has some other grains of truth that we must heed. The key problem with Lisp today stems from the tension between two opposing software philosophies. The two philosophies are called The Right Thing and Worse is Better. 2.1 The Rise of Worse is Better I and just about every designer of Common Lisp and CLOS has had extreme exposure to the MIT/Stanford style of design. The essence of this style can be captured by the phrase the right thing. To such a designer it is important to get all of the following characteristics right: • Simplicity—the design must be simple, both in implementation and interface. It is more important for the interface to be simple than the implementation. • Correctness—the design must be correct in all observable aspects. Incorrectness is simply not allowed. • Consistency—the design must not be inconsistent. A design is allowed to be slightly less simple and less complete to avoid inconsistency. Consistency is as important as correctness. MRI Alignment Program Short Long Size WS Original 2:22 *:** 4.45mb 3.50mb Final 0:42 4:11 1.65mb 2.25mb Reduce Computer Algebra System Size Time Faults CPU Original 6.68mb 6:2

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Survey of companions of cancer patients about the need and how to express getting incurable cancer

Introduction: Expressing bad news in medicine is one of the most important measures taken by medical staff that should be given to patients in special circumstances that it is necessary to examine the views of companions and patients in this regard. Therefore, the aim of this study was to investigate the necessity and manner of expressing bad news (incurable cancer) from the perspective of canc...

متن کامل

دیدگاه بیماران در مورد چگونگی انتقال خبر بد

Breaking bad news is an unavoidable part of the medical profession, and doctors and patients stand at the two sides of this function. There are different views about how to break bad news in different cultures and societies. In this study we assessed the viewpoints of hospitalized patients on how to break bad news. This cross sectional study was performed in 2011 at the Jahrom University of Me...

متن کامل

Teaching How to Break Bad News: Comparing Role-Play and Group Discussion on Practice of Medical Interns in Jahrom Medical School

Introduction: The Main challenge in training about breaking bad news is selection of appropriate educational method. This study was performed to assess the results of role-playing method versus group discussion in training about this skill. Methods: This was an interventional double blind study, performed in 2009-2010 in Jahrom University of Medical Sciences. 30 medical students were involved ...

متن کامل

گفتن خبر بد به بیمار و جوانب مختلف آن

Breaking bad news to the patients does not back to a long history and is a controversial issue between patients and physicians. Many physicians are reluctant to breaking bad news to patients and this is not desirable for most patients. For example, in Northern European countries and United States, most physicians usually break bad news to the patients, while in Southern and Eastern European cou...

متن کامل

Propose a model for delivering bad news based on Iranian-Islamic culture: Hybrid study

introduction: Bad news can cause a strong emotional and steressful response, unpleasant feeling or behavior, it can change their attitude towards themselves or their futures. Given the importance of how to tell bad news to a patient or his/her family and its consequent effect, this study aims to present a solution and a model for this issue based on Islamic- Iranian culture by reviewing previou...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1990